#pragma once
#include "cc9d.h"


enum eRespond {
	DONE = 0x00,                      // 操作成功
	FAIL = 0x01,                      // 操作失败
	BAD_LENGTH = 0x02,                // 数据长度错误
};


//create response package
static inline void createResponsePkg(sCc9dPkg* send_pkg, const sCc9dPkg* recv_pkg) {
	send_pkg->from_port = recv_pkg->to_port;
	send_pkg->to_port = recv_pkg->from_port;
	send_pkg->remote_addr = recv_pkg->remote_addr;
}
static inline void responePkg(sCc9dPkg* recv_pkg, uint8 result) {
	sCc9dPkg send_pkg;
	createResponsePkg(&send_pkg, recv_pkg);
	send_pkg.datas[0] = recv_pkg->datas[0];
	send_pkg.datas[1] = result;
	cc9d_SendPkg(&send_pkg, 2);
}
